//导入request.js请求工具
import request from '@/utils/request.js'
import { useTokenStore } from '@/stores/token.js'
import { ElMessage } from 'element-plus'
//图书分类
export const bookClassifyListService = ()=>{

    return request.get('/books/classify')
}

//根据name查询分类
export const bookClassifyByNameService = (categoryData)=>{

    return request.post('/books/getByNameClassify',categoryData)

}
//图书分类添加
export const bookClassifyAddService = (categoryData)=>{
    return request.post('/books/addClassify',categoryData)
    
}

//图书分类修改
export const bookClassifyUpdateService = (categoryData)=>{

    return request.put('/books/updateClassify',categoryData)
    
}

//图书分类删除
export const bookClassifyDeleteService = (id)=>{
    
    return request.delete('/books/deleteClassify?id='+id)
}


//图书列表查询
export const bookListService = (params)=>{
    return request.get('/books',{params:params})
}

//添加图书
export const addBookService = (bookData)=>{
    return request.post('/books/addBook',bookData)
}

//修改图书
export const updateBookService = (bookData)=>{
    return request.put('/books/updateBook',bookData)
}

//图书删除
export const bookDeleteService = (id)=>{
    
    return request.delete('/books/deleteBook?id='+id)
}

//借阅列表查询
export const borrowListService = (params)=>{
    return request.get('/books/borrow',{params:params})
}


//核验
export const checkBorrowService = (checkData)=>{
    return request.post('/books/checkBorrow',checkData)
}

//核验
// export const checkBorrow1Service = (checkData)=>{
//     return request.post('/books/checkBorrow1',checkData)
// }

//添加借阅
export const addBorrowService = (borrowData)=>{
    return request.post('/books/addBorrow',borrowData)
}

//还书
export const returnBookService = (params)=>{
    return request.put('/books/returnBook',params)
}
